import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        List<Integer> myArrayList = new ArrayList<>();
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n != 0) {
            n--;
            int data = scanner.nextInt();
            myArrayList.add(data);
        }
        int i = 0;
        int key = scanner.nextInt();
        while(i != myArrayList.size()) {
            if(myArrayList.get(i) == key) {
                myArrayList.remove(i);
                continue;
            }
            i++;
        }
        for(int j = 0; j < myArrayList.size(); ) {
            System.out.print(myArrayList.get(j) + " ");
            j++;
        }
    }
}